import request from './request'

export const selectFirstDocumentId = () => {
    return request({
        url: '/admin/front/firstFile',
        method: 'get'
    })
}

// 获取文件目录树
export const getDocumentTree = (type) => {
    return request({
        url: `/admin/front/documentTreeData`,
        method: 'get',
        params: {type:type}
    })
}

export const selectFileUrl = id => {
    return request({
        url: '/admin/front/selectFileUrl/' + id,
        method: 'get'
    })
}

export const selectSpaceFileUrl=id=>{
    return request({
        url:'/admin/front/getSpaceFileUrl/'+id,
        method:'get'
    })
}

export const download = documentId => {
    return request({
        url: '/admin/file/downloadFileByDocId',
        method: 'get',
        responseType: 'blob',
        params: {'documentId': documentId}
    })
}

export const selectDocIdByModuleName=moduleName=>{
    return request({
        url:"/admin/front/selectDocIdByModuleName",
        method:'get',
        params:{moduleName:moduleName}
    })
}

export const getDocumentInfo = id => {
    return request({
        url: '/admin/front/document/' + id,
        method:'get',
    })
}
